package com.skillscompetition.skillscompetition.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.skillscompetition.skillscompetition.bean.Examinee;
import com.skillscompetition.skillscompetition.bean.SkillScontest;
import com.skillscompetition.skillscompetition.mapper.ExamineeMapper;
import com.skillscompetition.skillscompetition.service.IExamineeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author lwg
 * @since 2019-11-09
 */
@Service
public class ExamineeServiceImpl extends ServiceImpl<ExamineeMapper, Examinee> implements IExamineeService {

    @Override
    public PageInfo<Examinee> getExaminee(Integer page,Integer paSize,String sort) {
        PageHelper.startPage(page,paSize);
        QueryWrapper<Examinee> wrapper=new QueryWrapper<>();
        /*根据序号查找*/
        wrapper.like(!StringUtils.isEmpty(sort),"number",sort);
        List<Examinee> list = this.list(wrapper);
       // PageInfo<Examinee> examineePageInfo = ;
        return new PageInfo<>(list);
    }

    @Transactional
    public Boolean updateExaminee(Examinee examinee) {
        boolean flag = this.updateById(examinee);
        return flag;
    }
}
